package com.oak.designmode._01_factoryPattern.factoryMethod;


/**
 * 工厂方法模式
 *
 * @ClassName: FactoryTest
 * @Description  此模式相对于简单工厂模式，增删不同口味的冰淇淋，更加方便
 * @Author guoxy
 * @Date 2019/12/4
 * @Version 1.0
 */
public class Test {

    public static void main(String[] args) {

        //IceCreamFactory工厂接口，OrangeIceCreamFactory实现类

        //生产苹果味冰激凌
        IceCreamFactory appleFactory = new AppleIceCreamFactory();
        IceCream appleIceCream = appleFactory.createIceCream();
        appleIceCream.taste();

        //生产香蕉口味冰激凌
        IceCreamFactory bananaFactory = new BananaIceCreamFactory();
        IceCream bananaIceCream = bananaFactory.createIceCream();
        bananaIceCream.taste();

        //生产橘子口味冰激凌
        IceCream orangeIceCream = new OrangeIceCreamFactory().createIceCream();
        orangeIceCream.taste();
    }
}
